package byte1;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

public class FileInputStream2 {
    public static void main(String[] args) throws Exception {
        // 读取多个字节
        InputStream is = new FileInputStream("C:\\Users\\zjd\\IdeaProjects\\java\\src\\itheima.02.txt");
//        byte[] buffter = new byte[3];
//        int len = is.read(buffter);
//        String rs = new String(buffter);
//        System.out.println(rs);
//        System.out.println("当前读取字节数:" + len);
//
//
//        int len1 = is.read(buffter);
//        // 读取多少，倒出多少
//        String rs1 = new String(buffter,0,len);
//        System.out.println(rs1);
//        System.out.println("当前读取字节数:" + len1);

            // 循环改造
        byte[] buffter = new byte[3];
        int len;
        while ((len = is.read(buffter)) != -1){
            String rs = new String(buffter,0,len);
            System.out.print(rs);
        }
        is.close();
    }

}

